Optimal. Leaf size=74 \[ 2 a^2 x+\frac {2 a^2 \cot (c+d x)}{d}-\frac {i a^2 \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {2 i a^2 \log (\sin (c+d x))}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 74, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 4, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3623, 3610,
3612, 3556} \begin {gather*} -\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {i a^2 \cot ^2(c+d x)}{d}+\frac {2 a^2 \cot (c+d x)}{d}-\frac {2 i a^2 \log (\sin (c+d x))}{d}+2 a^2 x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3610
Rule 3612
Rule 3623
Rubi steps
\begin {align*} \int \cot ^4(c+d x) (a+i a \tan (c+d x))^2 \, dx &=-\frac {a^2 \cot ^3(c+d x)}{3 d}+\int \cot ^3(c+d x) \left (2 i a^2-2 a^2 \tan (c+d x)\right ) \, dx\\ &=-\frac {i a^2 \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+\int \cot ^2(c+d x) \left (-2 a^2-2 i a^2 \tan (c+d x)\right ) \, dx\\ &=\frac {2 a^2 \cot (c+d x)}{d}-\frac {i a^2 \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}+\int \cot (c+d x) \left (-2 i a^2+2 a^2 \tan (c+d x)\right ) \, dx\\ &=2 a^2 x+\frac {2 a^2 \cot (c+d x)}{d}-\frac {i a^2 \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\left (2 i a^2\right ) \int \cot (c+d x) \, dx\\ &=2 a^2 x+\frac {2 a^2 \cot (c+d x)}{d}-\frac {i a^2 \cot ^2(c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {2 i a^2 \log (\sin (c+d x))}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 5 vs. order 3 in
optimal.
time = 0.50, size = 105, normalized size = 1.42 \begin {gather*} -\frac {a^2 \cot ^3(c+d x) \, _2F_1\left (-\frac {3}{2},1;-\frac {1}{2};-\tan ^2(c+d x)\right )}{3 d}+\frac {a^2 \cot (c+d x) \, _2F_1\left (-\frac {1}{2},1;\frac {1}{2};-\tan ^2(c+d x)\right )}{d}-\frac {i a^2 \left (\cot ^2(c+d x)+2 \log (\cos (c+d x))+2 \log (\tan (c+d x))\right )}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.21, size = 78, normalized size = 1.05
method | result | size |
derivativedivides | \(\frac {-a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 i a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) | \(78\) |
default | \(\frac {-a^{2} \left (-\cot \left (d x +c \right )-d x -c \right )+2 i a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )}{d}\) | \(78\) |
risch | \(-\frac {4 a^{2} c}{d}+\frac {2 i a^{2} \left (15 \,{\mathrm e}^{4 i \left (d x +c \right )}-18 \,{\mathrm e}^{2 i \left (d x +c \right )}+7\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}\) | \(78\) |
norman | \(\frac {-\frac {a^{2}}{3 d}+2 a^{2} x \left (\tan ^{3}\left (d x +c \right )\right )+\frac {2 a^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {i a^{2} \tan \left (d x +c \right )}{d}}{\tan \left (d x +c \right )^{3}}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {2 i a^{2} \ln \left (\tan \left (d x +c \right )\right )}{d}\) | \(101\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 83, normalized size = 1.12 \begin {gather*} \frac {6 \, {\left (d x + c\right )} a^{2} + 3 i \, a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 6 i \, a^{2} \log \left (\tan \left (d x + c\right )\right ) + \frac {6 \, a^{2} \tan \left (d x + c\right )^{2} - 3 i \, a^{2} \tan \left (d x + c\right ) - a^{2}}{\tan \left (d x + c\right )^{3}}}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 139 vs. \(2 (68) = 136\).
time = 0.47, size = 139, normalized size = 1.88 \begin {gather*} -\frac {2 \, {\left (-15 i \, a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 18 i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 7 i \, a^{2} + 3 \, {\left (i \, a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} - 3 i \, a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 i \, a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - i \, a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 136 vs. \(2 (66) = 132\).
time = 0.23, size = 136, normalized size = 1.84 \begin {gather*} - \frac {2 i a^{2} \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac {30 i a^{2} e^{4 i c} e^{4 i d x} - 36 i a^{2} e^{2 i c} e^{2 i d x} + 14 i a^{2}}{3 d e^{6 i c} e^{6 i d x} - 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} - 3 d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 146 vs. \(2 (68) = 136\).
time = 0.86, size = 146, normalized size = 1.97 \begin {gather*} \frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 i \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 96 i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) - 48 i \, a^{2} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - 27 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {-88 i \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 27 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 6 i \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.81, size = 68, normalized size = 0.92 \begin {gather*} \frac {2\,a^2\,\mathrm {cot}\left (c+d\,x\right )}{d}+\frac {4\,a^2\,\mathrm {atan}\left (2\,\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{d}-\frac {a^2\,{\mathrm {cot}\left (c+d\,x\right )}^3}{3\,d}-\frac {a^2\,{\mathrm {cot}\left (c+d\,x\right )}^2\,1{}\mathrm {i}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________